package com.xieyingwangluo.yxpart.utils;

/**
 * 异常处理类
 */
public class ExceptionUtils {

    /**
     * 生成异常字符串
     * @param e
     * @param splite
     * @return
     */
    public static String buildExceptionStr(Exception e, String splite){

        if(e==null){
            return "";
        }

        StringBuffer sb=new StringBuffer();
        int i=0;
        for( StackTraceElement st:e.getStackTrace()){
            sb.append(i).append(":").append(st.getFileName()).append(" - ").append(st.getClassName()).append('.').append(st.getMethodName())
                    .append('[').append(st.getLineNumber()).append(']').append(splite);
        }
        return sb.toString();
    }


}
